package com.ruoyi.web.controller.school;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.school.domain.PacReslutLevel2;
import com.ruoyi.school.service.PacReslutLevel2Service;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/school/level2")
public class ResultLevel2Controller extends BaseController {
    @Resource
    private PacReslutLevel2Service pacReslutLevel2Service;

    @GetMapping("/list")
    public TableDataInfo list(PacReslutLevel2 reslutLevel2) {
        startPage();
        List<PacReslutLevel2> list = pacReslutLevel2Service.getList(reslutLevel2);
        return getDataTable(list);
    }

    @GetMapping("/details")
    public AjaxResult details(PacReslutLevel2 rereslutLevel) {
        PacReslutLevel2 details = pacReslutLevel2Service.getDetails(rereslutLevel);
        return success(details);
    }

    @Log(title = "学术等级", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody PacReslutLevel2 rereslutLevel) {
        boolean add = pacReslutLevel2Service.add(rereslutLevel);
        return success(add);
    }

    @Log(title = "学术等级", businessType = BusinessType.UPDATE)
    @PutMapping("/update")
    public AjaxResult update(@RequestBody PacReslutLevel2 rereslutLevel) {
        boolean update = pacReslutLevel2Service.edit(rereslutLevel);
        return success(update);
    }

    @Log(title = "学术等级", businessType = BusinessType.DELETE)
    @DeleteMapping("/delete")
    public AjaxResult delete(PacReslutLevel2 rereslutLevel) {
        boolean delete = pacReslutLevel2Service.delete(rereslutLevel);
        return success(delete);
    }

    @GetMapping("/all")
    public AjaxResult all(PacReslutLevel2 rereslutLevel) {
        List<PacReslutLevel2> list = pacReslutLevel2Service.getAllList(rereslutLevel);
        return success(list);
    }


}
